import React, { useEffect, useState } from "react";
import Swiper from "./components/swiper.js";
import Tabs from "./components/tab.js";
import Groups from "./components/groups.jsx";
import InfoList from "./components/infoList.jsx";
export default function Index(props) {
  let [swiperList, setSwiperList] = useState([]);
  let [tabs, setTabs] = useState([]);
  // 只执行一次
  useEffect(() => {
    getSwiperList();
    getTabs();
  }, []);
  function getSwiperList() {
    setSwiperList([
      "https://img0.baidu.com/it/u=460683712,952918800&fm=26&fmt=auto",
      "https://img2.baidu.com/it/u=1342887657,3185295709&fm=253&fmt=auto&app=138&f=JPEG?w=1920&h=500",
      "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F011e3458df705ca801219c77279b96.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1643332449&t=288c17da33fb6280a0a6c0e836cf0ec2",
      "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F0111025ec2950fa801207200ba3d24.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1643332449&t=0a2ec4e8996a02dbca632aa8fff3fe60",
      "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F0198ff55c4790b32f8755e66585796.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1643332449&t=3c3138a8eca14b310c29367e4c53aef5",
    ]);
  }
  function getTabs() {
    console.log('getTabs')
    setTimeout(() => {
      setTabs([1, 2, 3, 4]);
    }, 1000);
  }
  return (
    <div className="container" style={{ paddingBottom: "50px" }}>
        <Swiper swiperList={swiperList}></Swiper>
        <Tabs tabs={tabs} />
        <Groups />
        <InfoList />
    </div>
  );
}
